<?php
class Modules_ModulesList implements Iterator
{
 	public $var = array();
	private $ignore_modules=array("Common");
    public function __construct()
    {
     	
    	$directory=dirname(__FILE__);
    	$dh = @opendir( $directory );
    	while( false !== ( $file = readdir( $dh ) ) )
    	  	if(is_dir($directory."/".$file) && !in_array($file,$this->ignore_modules))
    	  		if(is_dir($directory."/".$file."/Model"))
    	  		{
    	  			
    	  			$dh1 = @opendir( $directory."/".$file."/Model" );
    	  			while( false !== ( $file1 = readdir( $dh1 ) ) )
    	  			{
    	  				
    	  				 $class=basename($file1, ".inc.php");		 
    	  				 if(is_file($directory."/".$file."/Model/".$class.".inc.php"))
      					 	$this->var[$file][$class]="Modules_".$file."_Model_".$class;
      					
    	  				
    	  			}
    	  		}
		
    }

    public function rewind() {
        reset($this->var);
    }

    public function current() {
        $var = current($this->var);
        return $var;
    }

    public function key() {
        $var = key($this->var);
        return $var;
    }

    public function next() {
        $var = next($this->var);
        return $var;
    }

    public function valid() {
        $var = $this->current() !== false;
        return $var;
    }
}


?>